set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Jellyfin Media Player")
set(CPACK_PACKAGE_VENDOR "Jellyfin")
set(CPACK_PACKAGE_NAME "Jellyfin Media Player")
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_NANO})

if(APPLE)
  set(CPACK_SYSTEM_NAME "macosx-x86_64")
elseif(WIN32)
  include(FetchDependencies)
  set(CPACK_SYSTEM_NAME ${ARCHSTR})
else()
  set(CPACK_SYSTEM_NAME linux-${CMAKE_HOST_SYSTEM_PROCESSOR})
endif()
set(CPACK_PACKAGE_FILE_NAME "JellyfinMediaPlayer-${VERSION_STRING}-${CPACK_SYSTEM_NAME}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "JellyfinMediaPlayer-${VERSION_STRING}-src")

set(CPACK_PACKAGE_INSTALL_DIRECTORY "JellyfinMediaPlayer")
set(CPACK_STRIP_FILES 1)


if(WIN32)
  include(WindowsInstaller)
  install(FILES ${CMAKE_SOURCE_DIR}/bundle/win/qt.conf DESTINATION .)
else(WIN32)
  set(CPACK_GENERATOR "ZIP")
  if(APPLE)
    set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
  endif(APPLE)
  configure_file(${CMAKE_SOURCE_DIR}/CMakeModules/CPackGeneratedConfig.cmake.in ${CMAKE_BINARY_DIR}/CPackGeneratedConfig.cmake)
  set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_BINARY_DIR}/CPackGeneratedConfig.cmake)

  include(CPack)
  cpack_add_component(Core DISPLAY_NAME "Jellyfin Media Player" DESCRIPTION "Jellyfin Media Player (Core Application)" REQUIRED)
endif(WIN32)